<?php
session_start();
include 'config.php';
include 'includes.php';
include 'functions.php';

$header = "<link rel='stylesheet' type='text/css' href='css/simpleFAQ.css'/>";
$header .= "<script type='text/javascript' src='js/jquery.quicksilver.js'></script>";
$header .= "<script type='text/javascript' src='js/jquery.simpleFAQ-0.7.js'></script>";


print_header("Proponi i tuoi testi", $header);
print_sidebar(array("hide_search" =>TRUE));
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Il mercatino dei testi scolastici - disponibilità testi</title>

</head>

<body>
<div id="main-content" >
<h1 align="center">Proponi i tuoi testi</h1>
<p align="justify">In questa pagina, tramite il form posto di seguito &egrave; possibile proporre i propri libri usati al mercatino, che se interessato vi contatter&agrave; in tempi brevi (entro la giornata) tramite email. Ricevuta l'email con risposta chiaramente positiva per far pervenire i libri al mercatino il cliente pu&ograve; scegliere sia di spedirlo a proprie spese che di portarlo personalmente al negozio</p><br />
<div id="request-container">
    <form id="sell_books" name="sell_books" method="post" onsubmit="return false;"">
       <fieldset id="send_request">
        <legend>Credenziali - tutti i campi sono obbligatori</legend>
          	
          	<label class="form_label" for="name">Nome</label>
          	<input type="text" name="name" id="name" class="required"/> 
          	
          	<label class="form_label" for="surname">Cognome</label>
          	<input type="text" name="surname" id="surname"  class="required"/>
          	
          	<label class="form_label" for="tax_code">Codice Fiscale</label>
          	<input type="text" name="tax_code" id="tax_code"  class="required"/>
 
          	<label class="form_label" for="city"> Localit&agrave;</label>
          	<input type="text" name="city" id="city"  class="required"/>
          	
          	<label class="form_label" for="address"> Indirizzo</label>
          	<input type="text" name="address" id="address"  class="required"/>
          	
          	<label class="form_label" for="cap"> CAP</label>
          	<input type="text" name="cap" id="cap"  class="required digits"/>
       
          	<label class="form_label" for="phone">Telefono</label>
          	<input type="text" name="phone" id="phone"  class="required"/>
       
          	<label class="form_label" for="mobile"> Cellulare</label>
          	<input type="text" name="mobile" id="mobile" class="required"/><span></span>
        
        	<label class="form_label" for="email">Email</label>
			<input type="text" name="email" id="email"  class="required email"/>
        
		</fieldset>
 		<br />
               
      <fieldset>
        <legend>Inserisci qui i dati dei libri che vuoi proporre(Isbn/Ean,Autore,Titolo,Casa Editrice):</legend>
          <p>
            <label for="comunicazioni"></label>
            <textarea name="book_textarea" id="book_textarea" cols="45" rows="5" class="required"> </textarea>
          </p>
    </fieldset><br />
   <p>
    <a id="sell_books_submit" style="float:right" href="javascript:return false;" class="button orange-button">Invia richiesta</a>
    </p>
	</form>
	</div>
</div>
<script type="text/javascript">
var validation = $("#sell_books").validate();

$("#sell_books_submit").click(function(){
	
	$("#sell_books").submit();
	
	
});

$("#sell_books").submit(function(){
	if ( validation.form() ){
		trim_all();
		var dataSend = $("#sell_books").serialize()+"&request_type=sell_books"; 
		$.ajax({
			  url: 'ajax.php',
			  type: "POST",
			  data: dataSend,
			  dataType: "json",
			  success: function( data ) {
				 if(data['request_sent'] == true){
					 $("#main-content").fadeOut("slow", function(){
						  $(this).html("<h4 class='confirm'>Richiesta inoltrata correttamente, verrai ricontattato quanto prima.<h4>");
						  $('html, body').animate({ scrollTop: 0 }, 'slow');
						  $(this).fadeIn("slow");


						  });
				 }
				  
			  }
			  
		});
	}
});

function trim_all(){
	$('input, textarea').each(function(){
	    $(this).val(jQuery.trim($(this).val()));
	});
	
}

</script>

</html>
  
 <?php 
print_footer();
?>